package com.lovo.common.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.Data;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
 * 
 * @TableName t_product
 */
@TableName(value ="t_product")
@Data
@Document(indexName = "index-shop")
public class Product implements Serializable {
    /**
     * 
     */
    @TableId(value = "p_id", type = IdType.AUTO)
    private Integer id;

    /**
     * 
     */
    @TableField(value = "p_name")
    @Field(type= FieldType.Text,analyzer = "smartcn")
    private String name;

    /**
     * 
     */
    @TableField(value = "p_price")
    @Field(type= FieldType.Double)
    private Double price;

    /**
     * 
     */
    @TableField(value = "p_count")
    @Field(type= FieldType.Integer,name = "count")
    private Integer count;

    /**
     * 
     */
    @TableField(value = "p_image_path")
    @Field(type= FieldType.Keyword)
    private String imagePath;

    /**
     * 
     */
    @TableField(value = "p_create_time")
    @Field(type = FieldType.Date, format = {DateFormat.date_hour_minute_second_millis})
    private LocalDateTime createTime;

    /**
     * 
     */
    @TableField(value = "p_update_time")
    @Field(type = FieldType.Date, format = {DateFormat.date_hour_minute_second_millis})
    private LocalDateTime updateTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}